


/**
 * @file MSCData.hpp
 * Monitor Station Coordinate file data
 */

#ifndef MSCDATA_HPP
#define MSCDATA_HPP

#include <string>
#include "StringUtils.hpp"
#include "Triple.hpp"
#include "Position.hpp"
#include "CommonTime.hpp"
#include "YDSTime.hpp"
#include "FFData.hpp"
#include "Xvt.hpp"

namespace gpstk
{
    /** @addtogroup MSC */
    //@{

    /**
     * Model for a Monitor Station Coordinates File Data Record
     */
    class MSCData : public FFData
    {
    public:

        /// Constructor
        MSCData() throw() : time(YDSTime()) {}

        /// Destructor
        virtual ~MSCData() throw() {}

        /**
         * Returns position, velocity, time in ECEF coords, units meters, for the indicated time.
         * @param t time for which to calcuate the position
         * @throw InvalidRequest If the request can not be completed for any
         *              reason, this is thrown. The text may have additional
         *              information as to why the request failed.
         */
        Xvt getXvt(const YDSTime& t) const noexcept(false);

        YDSTime time;           ///< date coordinates released
                                ///< (Bookkeeping convenience not used)
        unsigned long station;  ///< Monitor Station number (e.g. 10234)
        std::string mnemonic;   ///< Monitor Station identifier (e.g. ARLM)
        YDSTime refepoch;       ///< epoch of coordinates and velocities
        YDSTime effepoch;       ///< earliest epoch data is valid
        Triple coordinates;     ///< ECEF XYZ coordinates
        Triple velocities;      ///< ECEF XYZ velocities
        Triple antOffset;       ///< antenna offset
        std::string antType;    ///< antenna type

        /// MSCData \b is data, so this always return \c true
        virtual bool isData() const { return true; }

    protected:

        /// Write an MSCData object in the format specified by the stream
        virtual void reallyPutRecord(gpstk::FFStream& ffs) const
            noexcept(false);

        /**
         * Retrieve an MSCData record from the given gpstk::FFStream.
         * If there is a problem reading from the stream, it
         * is reset to its original position and it's failbit is set.
         * @throws StringException when a gpstk::StringUtils functions fails
         * @throws gpstk::FFStreamError when exceptions(failbit) is set and
         *  a read or formatting error occurs. This also resets the
         *  stream to it pre-read position.
         */
        virtual void reallyGetRecord(gpstk::FFStream& ffs)
            noexcept(false);

    }; // End of class 'MSCData'

    //@}

} // namespace gpstk

#endif  // MSCDATA_HPP
